home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15003 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  39 lines

  1. Newsgroups: alt.msdos.programmer,comp.lang.c,comp.lang.pascal.misc
  2. Path: angel.qdeck.com!usenet
  3. From: @test111
  4. Subject: Re: typecasting preferences
  5. Organization: Quarterdeck Corp.
  6. Date: Tue, 16 Apr 1996 15:59:30 GMT
  7. Message-ID: <N.041696.085930.117@machin.qdeck.com>
  8. X-Newsreader: Quarterdeck Message Center [2.00]
  9. References: <4l020g$i9j@srvr1.engin.umich.edu>
  10. Sender: usenet@qdeck.com (Netnews Administrator)
  11.  
  12. On 4/16/96 4:58AM, in message <4l020g$i9j@srvr1.engin.umich.edu>, HASDI 
  13. RODZMANN HASHIM <hasdi@news-server.engin.umich.edu> wrote:
  14.  
  15. > Hi guys! I think my earlier post got lost so here it is again.... This is
  16. > for a student compiler project of mine.... 
  17. > If you have a choice, do you want the parethesis pair over the caster
  18. > (C-style) or over the castee (Pascal-style)? eg...
  19. > int a;
  20. > float b;
  21. > a = (int)b; /* cast to int */
  22. > a = int(b); /* allowable in C++ */
  23. > ...as for Pascal...
  24. > a := integer(b); { "a" in an integer and "b" is a real }
  25. > Thanx!
  26. I believe you would want the parens over the type not the variable.  Your first 
  27. example a = (int)b looks like the way I would do it anyway.  I am sure someone 
  28. will correct me on this one.
  29.  
  30. -John Machin
  31. machin@gnn.com
  32.  
  33.